package com.test.project.system.post.service.impl;

import java.util.List;
import com.test.common.utils.DateUtils;
import com.test.common.utils.security.ShiroUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.test.project.system.post.mapper.ZhiyuanPostMapper;
import com.test.project.system.post.domain.ZhiyuanPost;
import com.test.project.system.post.service.IZhiyuanPostService;
import com.test.common.utils.text.Convert;

/**
 * 志愿文章Service业务层处理
 * 
 * @author test
 * @date 2023-12-05
 */
@Service
public class ZhiyuanPostServiceImpl implements IZhiyuanPostService 
{
    @Autowired
    private ZhiyuanPostMapper zhiyuanPostMapper;

    /**
     * 查询志愿文章
     * 
     * @param id 志愿文章ID
     * @return 志愿文章
     */
    @Override
    public ZhiyuanPost selectZhiyuanPostById(Long id)
    {
        return zhiyuanPostMapper.selectZhiyuanPostById(id);
    }

    /**
     * 查询志愿文章列表
     * 
     * @param zhiyuanPost 志愿文章
     * @return 志愿文章
     */
    @Override
    public List<ZhiyuanPost> selectZhiyuanPostList(ZhiyuanPost zhiyuanPost)
    {
        return zhiyuanPostMapper.selectZhiyuanPostList(zhiyuanPost);
    }

    /**
     * 新增志愿文章
     * 
     * @param zhiyuanPost 志愿文章
     * @return 结果
     */
    @Override
    public int insertZhiyuanPost(ZhiyuanPost zhiyuanPost)
    {
    	zhiyuanPost.setCreateBy(ShiroUtils.getLoginName());
        zhiyuanPost.setCreateTime(DateUtils.getNowDate());
        return zhiyuanPostMapper.insertZhiyuanPost(zhiyuanPost);
    }

    /**
     * 修改志愿文章
     * 
     * @param zhiyuanPost 志愿文章
     * @return 结果
     */
    @Override
    public int updateZhiyuanPost(ZhiyuanPost zhiyuanPost)
    {
        return zhiyuanPostMapper.updateZhiyuanPost(zhiyuanPost);
    }

    /**
     * 删除志愿文章对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZhiyuanPostByIds(String ids)
    {
        return zhiyuanPostMapper.deleteZhiyuanPostByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除志愿文章信息
     * 
     * @param id 志愿文章ID
     * @return 结果
     */
    @Override
    public int deleteZhiyuanPostById(Long id)
    {
        return zhiyuanPostMapper.deleteZhiyuanPostById(id);
    }
}
